<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="http://www.petercorke.com/RVC/common/toolboxhelp.css">
    <title>M-File Help: niblack</title>
  </head>
  <body>
  <table border="0" cellspacing="0" width="100%">
    <tr class="subheader">
      <td class="headertitle">M-File Help: niblack</td>
      <td class="subheader-left"><a href="matlab:open niblack">View code for niblack</a></td>
    </tr>
  </table>
<h1>niblack</h1><p><span class="helptopic">Adaptive thresholding</span></p><strong>T</strong> = <span style="color:red>niblack</span>(<strong>im</strong>, <strong>k</strong>, <strong>w2</strong>) is the per-pixel (local) threshold to apply to
image <strong>im</strong>.  <strong>T</strong> has the same dimensions as <strong>im</strong>.  The threshold at each pixel is
a function of the mean and standard deviation computed over a WxW window,
where W=2*w2+1.

[<strong>T</strong>,<strong>m</strong>,<strong>s</strong>] = <span style="color:red>niblack</span>(<strong>im</strong>, <strong>k</strong>, <strong>w2</strong>) as above but returns the per-pixel mean <strong>m</strong>
and standard deviation <strong>s</strong>.

<h2>Example</h2>
<pre style="width: 90%%;" class="examples">
t&nbsp;=&nbsp;niblack(im,&nbsp;-0.2,&nbsp;20);
idisp(im&nbsp;>=&nbsp;t);
</pre>
<h2>Notes</h2>
<ul>
  <li>This is an efficient algorithm very well suited for binarizing
text.</li>
  <li>W2 should be chosen to be half the "size" of the features to be
segmented, for example, in text segmentation, the height of a
character.</li>
  <li>A common choice of k=-0.2</li>
</ul>
<h2>Reference</h2>
An Introduction to Digital Image Processing,
W. <span style="color:red>niblack</span>,
Prentice-Hall, 1986.

<h2>See also</h2>
<p>
<a href="matlab:doc otsu">otsu</a>, <a href="matlab:doc ithresh">ithresh</a></p>
<hr>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr class="subheader" valign="top"><td>&nbsp;</td></tr></table>
<p class="copy">&copy; 1990-2011 Peter Corke.</p>
</body></html>